const Feedback=require('../models/feedback');


//添加反馈
exports.addFeedback=async (params)=>{
    const result = await Feedback.create(params);
    return result
}

//添加反馈结果
exports.overFeedback=async (id,params)=>{
    const result = await Feedback.update(params,{
        where:{
            id
        }
    })
    return result
}

//查询反馈
exports.findFeedback=async (pagenum=1,pagesize=10)=>{
    const total =await Feedback.count();
    const lists =await Feedback.findAll({
        // attributes:['id','title','content','handleResult','Initiator'],
        offset:(pagenum - 1)*pagesize,
        limit: +pagesize
    })
    return {lists,total}
}

//查询详细反馈结果
exports.findOver=async (id)=>{
    const result = await Feedback.findAll({
        where:{
            id
        }
    })
    return result
}